Repository navigation
Subtractive workflow: faces seen from inside, drawing in rooms, and picking on edges (#325) - #361
Merged
Merged
Conversation
…s the subtractive workflow (#325) Placement: - In a model with the subtractive workflow the brushes are the empty space, so a shape pulled out of a room's surface cuts (a pillar) and one pushed into it adds (a pit), the other way round from a normal model. Faces drawn turned round (a subtractive brush's walls, every face of a model with the subtractive workflow) are seen from behind their brush's plane, where their texture read mirrored: - Their u runs the other way, after the surface's uv matrix, so by default they read as the face does from the front; a mirror in the uv matrix still mirrors them. Tangents follow. - Being the same for every mapping, texture lock and the uv tools keep matching what is drawn. - A hotspot tile is laid out from the side the surface is drawn on, and toggling texture lock carries its settings over from that side. - An omni-directional decal reaches such a face from the side it is drawn on, and lies along its texture as it is seen. Tests: - ChiselSubtractiveWorkflowTests: every generator and rooms carved several ways are drawn turned round, faces and normals facing into the room; turning the setting on and off rebuilds; textures on every generator and on carved rooms aren't mirrored, unless mirrored on purpose; tangents follow the texture; decals on a room's floor are whole and not mirrored, an omni decal along the floor's texture. - Placement: the operation for a shape pulled out or pushed in, with and without the subtractive workflow, and on the grid. - Hotspot tiles on a room's wall aren't mirrored, and toggling its texture lock changes nothing on screen; texture lock on faces seen from inside. - The subtractive workflow setting changes the model's input hash.
…ace on its edges (#325) Shapes drawn on a surface: - A shape drawn on a room's wall or floor (a surface seen from behind its brush's plane) keeps the side it was drawn on, instead of being turned to face out of the brush. Made into a brush, it now reaches out of the surface into the room, not into the solid behind it. - The operation of a brush pulled out of or pushed into a surface is the model's (ChiselModelComponent.OperationOutOfSurface): it adds pulled out and cuts pushed in, the other way round with the subtractive workflow. The placement tools and a shape made into a brush both use it. Picking: - A point on an edge of a triangle is in it (MathExtensions.PointInTriangle), so a ray hitting the edge between two triangles of a surface finds the surface's side: its plane faces the viewer, and with back faces left out, a surface hit from behind is left out. Tests (ChiselSubtractiveWorkflowTests unless said otherwise): - A room built in a model with the subtractive workflow is drawn as the same room carved out of a solid: boxes, a cylinder, a sphere, stairs, smoothed by group and by the model's angle, double sided, a non-square texture, a painted and a displaced floor, a hotspot material, a trim decal. - Collisions from inside a room: raycasts and a character controller. - Lighting: a lamp lights a room as a carved one, a pillar shadows it, the lightmap uvs match, and a baked lamp lights the floor and light probes as in a carved room, again after the room is changed. - A shape on a room's floor made into a brush is a pillar or a pit. - A ray finds a room's floor from inside, not from behind, also on its diagonal; PointInTriangle on an edge or a corner; a subtractive workflow room's surface picked from inside faces the viewer. - A texture moved or turned by the uv tools on a room's floor moves as it is seen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes and why
A model's Subtractive Workflow setting draws its brushes from inside: they are the rooms, carved out of solid space. This tests that workflow throughout and fixes what was wrong with it, and with the walls of rooms carved by subtractive brushes, which are drawn from inside the same way.
Faces drawn turned round (every face of a model with the subtractive workflow, a subtractive brush's walls in any model) are seen from behind their brush's plane:
Drawing brushes on surfaces:
ChiselModelComponent.OperationOutOfSurface.Picking:
MathExtensions.PointInTrianglecounts a point on an edge as in the triangle. A ray hitting the edge between two triangles of a surface found neither, so the surface's plane wasn't turned to the viewer and a surface hit from behind wasn't left out.The wiki's Subtractive Workflow page now describes the setting.
Fixes #325
How it was tested (scene, steps, Unity version)
New
ChiselSubtractiveWorkflowTests, with the setting on and against the same room carved out of a solid:A small carved level built by hand (Unity 6.6) looked right from inside: rooms joined, a pillar, stairs, lamps, unmirrored textures, a column and a pit drawn on the floors, an omni decal.
Full EditMode suite in Unity 6.6 (6000.6.0f1) and Unity 7 (7000.0.0a12), no failures.